/**********************************************
 * 	TestNoun.java							  *
 *  Course: CS3343							  *
 *  Version: 2.5    Release 3				  *
 *  Last Modified : 22 MAR 2013			      *
 **********************************************/
package testChecker;


import org.junit.Before;
import junit.framework.TestCase;
import checker.Noun;

import org.junit.Test;


public class TestNoun extends TestCase{

     
	@Before
	public void setUp() throws Exception {

	}
	
	//unit test for the Noun class
	@Test
	public void testNounA(){
		
		class NounStub extends Noun{
			public  boolean isOfType(String word){
				//get all the words starting with the letter that is the same as the initial letter of the input word
				//the second argument is the type of words to be retrieved for comparison, in this case, nouns
				//the return value is an array containing all the relevant words
				String[] nouns = {"age", "man","allocation", "location" };
				
				//simply compare each value in the array with the input word
				for(int i = 0; i < nouns.length; i++){
					if(nouns[i].equalsIgnoreCase(word))
						//returning true means this is a noun
						return true;
				}
				return false;
			}
		
		};
		
		NounStub nounStub = new NounStub();
		
		boolean result = nounStub.isOfType("age");
		assertEquals(true, result);
		
	}

	//unit test for the Noun class
	@Test
	public void testNounB(){
		
		class NounStub extends Noun{
			public  boolean isOfType(String word){
				//get all the words starting with the letter that is the same as the initial letter of the input word
				//the second argument is the type of words to be retrieved for comparison, in this case, nouns
				//the return value is an array containing all the relevant words
				String[] nouns = {"salary", "situation","seat", "solution" };
				
				//simply compare each value in the array with the input word
				for(int i = 0; i < nouns.length; i++){
					if(nouns[i].equalsIgnoreCase(word))
						//returning true means this is a noun
						return true;
				}
				return false;
			}
		
		};
		
		NounStub nounStub = new NounStub();
		
		boolean result = nounStub.isOfType("keep");
		assertEquals(false, result);
		
	}

	//integration test 1 with the FileIO class
	@Test
	public void testIntegrationWithFileIO1(){
	    Noun noun = new Noun();
		boolean result = noun.isOfType("stipulation");
		assertEquals(true, result);
	
	}
	
	//integration test 2 with the FileIO class
	@Test
	public void testIntegrationWithFileIO2(){
		Noun noun = new Noun();
		boolean result = noun.isOfType("temporily");
		assertEquals(false, result);
		
	}
	
	//integration test 3 with the FileIO class
	@Test
	public void testIntegrationWithFileIO3(){
	    Noun noun = new Noun();
		boolean result = noun.isOfType("seduction");
		assertEquals(true, result);
	
	}
	
	//integration test 4 with the FileIO class
	@Test
	public void testIntegrationWithFileIO4(){
		Noun noun = new Noun();
		boolean result = noun.isOfType("same");
		assertEquals(false, result);
		
	}
	
	//integration test 5 with the FileIO class
	@Test
	public void testIntegrationWithFileIO5(){
	    Noun noun = new Noun();
		boolean result = noun.isOfType("effectiveness");
		assertEquals(true, result);
	
	}
	
	//integration test 6 with the FileIO class
	@Test
	public void testIntegrationWithFileIO6(){
		Noun noun = new Noun();
		boolean result = noun.isOfType("efficient");
		assertEquals(false, result);
		
	}
	//test user-defined constructor
	@Test
	public void testUserDefinedConstructor(){
		Noun noun  = new Noun("[n]");
		String result = noun.getSign();
		assertEquals("[n]", result);
		
	}
	

}
